﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CollectionAndShare
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public const string FOLDER_ICON = "";
        public const string TAG_ICON = "Img/Metro Icon 78.ico";

        public Notebook currCollection;

        public Document doc;

        public Picture pic;

        public MainWindow()
        {
            InitializeComponent();

            

            this.lvMyNotebook.ItemsSource = CateCollection.CreateCateNotebooks();

            this.lvMyDocument.ItemsSource = CateCollection.CreateCateDocuments();

            this.lvMyVedio.ItemsSource = CateCollection.CreateCateVedios();

            this.lvMyMusic.ItemsSource = CateCollection.CreateCateMusic();

            this.lvMyPicture.ItemsSource = CateCollection.CreateCatePicture();

            currCollection = new Notebook();

            this.gridUserControl.Children.Clear();

            this.gridUserControl.Children.Add(currCollection);

            this.epdNotebook.IsExpanded = true;
        }

        private void grid1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }

        private void label5_MouseDown(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void epdNotebook_Expanded(object sender, RoutedEventArgs e)
        {
            this.epdDocument.IsExpanded = false;
            this.epdVedio.IsExpanded = false;
            this.epdMusic.IsExpanded = false;
            this.epdPicture.IsExpanded = false;
        }

        private void epdDocument_Expanded(object sender, RoutedEventArgs e)
        {
            this.epdNotebook.IsExpanded = false;
            this.epdVedio.IsExpanded = false;
            this.epdMusic.IsExpanded = false;
            this.epdPicture.IsExpanded = false;
        }

        private void epdVedio_Expanded(object sender, RoutedEventArgs e)
        {
            this.epdNotebook.IsExpanded = false;
            this.epdDocument.IsExpanded = false;
            this.epdMusic.IsExpanded = false;
            this.epdPicture.IsExpanded = false;
        }

        private void epdMusic_Expanded(object sender, RoutedEventArgs e)
        {
            this.epdNotebook.IsExpanded = false;
            this.epdVedio.IsExpanded = false;
            this.epdDocument.IsExpanded = false;
            this.epdPicture.IsExpanded = false;
        }

        private void epdPicture_Expanded(object sender, RoutedEventArgs e)
        {
            this.epdNotebook.IsExpanded = false;
            this.epdVedio.IsExpanded = false;
            this.epdMusic.IsExpanded = false;
            this.epdDocument.IsExpanded = false;
        }

        private void lvMyNotebook_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            CateCollection cate = (sender as ListBox).SelectedItem as CateCollection;

            currCollection = new Notebook(cate);

            this.gridUserControl.Children.Clear();

            this.gridUserControl.Children.Add(currCollection);
        }

        private void lvMyDocument_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            doc = new Document();

            this.gridUserControl.Children.Clear();

            this.gridUserControl.Children.Add(doc);
        }

        private void lvMyVedio_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            currCollection = new Notebook();

            this.gridUserControl.Children.Clear();

            this.gridUserControl.Children.Add(currCollection);
        }

        private void lvMyMusic_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        private void lvMyPicture_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            pic = new Picture();

            this.gridUserControl.Children.Clear();

            this.gridUserControl.Children.Add(pic);
        }


    }

    public class CateCollection
    {
        public string Icon { get; set; }

        public string CateName { get; set; }

        public string Date { get; set; }

        public CateCollection(string icon, string name, string date)
        {
            this.Icon = icon;
            this.CateName = name;
            this.Date = date;
        }

        public static List<CateCollection> CreateCateNotebooks() 
        {
            List<CateCollection> listCollection = new List<CateCollection>();
            for (int i = 0; i < 10; i++)
            {
                CateCollection collection01 = new CateCollection("Img/Align-justify.png", "C#精讲第" + i + "节", DateTime.Now.ToShortDateString());
                listCollection.Add(collection01);
            }
            return listCollection;
        }

        public static List<CateCollection> CreateCateDocuments()
        {
            CateCollection collection01 = new CateCollection("Img/Open file.png", "BDNACN", DateTime.Now.ToShortDateString());
            CateCollection collection02 = new CateCollection("Img/Open file.png", "CNBLOGS", DateTime.Now.ToShortDateString());
            CateCollection collection03 = new CateCollection("Img/Open file.png", "BAIDU", DateTime.Now.ToShortDateString());
            CateCollection collection04 = new CateCollection("Img/Open file.png", "GOOGLE", DateTime.Now.ToShortDateString());
            CateCollection collection05 = new CateCollection("Img/Open file.png", "IPHONE", DateTime.Now.ToShortDateString());
            CateCollection collection06 = new CateCollection("Img/Open file.png", "MIRCROSOFT", DateTime.Now.ToShortDateString());
            List<CateCollection> listCollection = new List<CateCollection>();
            listCollection.Add(collection01);
            listCollection.Add(collection02);
            listCollection.Add(collection03);
            listCollection.Add(collection04);
            listCollection.Add(collection05);
            listCollection.Add(collection06);
            return listCollection;
        }

        public static List<CateCollection> CreateCateVedios()
        {
            List<CateCollection> listCollection = new List<CateCollection>();
            for (int i = 0; i < 5; i++)
            {
                CateCollection collection01 = new CateCollection("Img/Video.png", "Vedio_" + i, DateTime.Now.ToShortDateString());
                listCollection.Add(collection01);
            }
            return listCollection;
        }

        public static List<CateCollection> CreateCateMusic()
        {
            List<CateCollection> listCollection = new List<CateCollection>();
            for (int i = 0; i < 5; i++)
            {
                CateCollection collection01 = new CateCollection("Img/Music.png", "Music_" + i, DateTime.Now.ToShortDateString());
                listCollection.Add(collection01);
            }
            return listCollection;
        }

        public static List<CateCollection> CreateCatePicture()
        {
            List<CateCollection> listCollection = new List<CateCollection>();
            for (int i = 0; i < 5; i++)
            {
                CateCollection collection01 = new CateCollection("Img/Camera.png", "PIC_" + i, DateTime.Now.ToShortDateString());
                listCollection.Add(collection01);
            }
            return listCollection;
        }

    }

    
}
